1. Field of the Invention
The present invention relates to a semiconductor storage device including a nonvolatile memory such as a flash memory.
2. Description of the Prior Art
A hard disk drive is one type of large capacity storage device. It has advantages of compactness and high cost performance, and it is used for a personal computer and a palm top (small and portable) personal computer. As small personal computers has become more popular, a hard disk drive mounted in the small personal computer has been utilized for outdoor use. When a personal computer is used outdoors, it is required to operate for a long time with a battery and to have high endurance. However, because a hard disk is driven with a motor and affected by vibrations, it is not well-suited for a portable personal computer.
Then, a semiconductor storage device compatible with a hard disk drive has attracted attention for use in a portable personal computer. A semiconductor storage device comprises a nonvolatile memory such as a flash memory. Though it is inferior on cost performance to a hard disk drive, it is not affected by mechanical shocks, and it consumes lower electric power because no motor is needed.
A flash memory has following features in contrast to a hard disk drive which can overwrite data in the same sector. Data in a sector to be accessed has to be erased before the data is written, and data cannot be overwritten. Though read and write can be performed in the unit of a sector (512 bytes), erase can only be performed in the unit of a relatively large size such as 64 kbytes. Further, an upper limit of the erase times for a sector are smaller than for a hard disk drive.
Also, a semiconductor storage device cannot be dealt with on erase in quite the same way as a hard disk drive. If data is already written to a sector of a sector number designated by a host, a sector which is not being used is searched, and the data is written to the unused sector. Thus, the data is written to a sector of a sector number not designated by the host. An address conversion table is provided in the semiconductor storage device to convert a sector number designated by a host (hereinafter referred to as a logical sector number) to a sector number where data is actually to be written (hereinafter referred to as a physical sector number). When a data read is requested by a host, a physical sector number is determined in correspondence to the logical sector number by referring to the address conversion table, and data is read from the physical sector determined as described above.
For a semiconductor storage device of 40 megabytes, two random access memory chips of 1 megabits or one random access memory chip of 4 megabits is needed. As storage capacity of a flash memory increases, a storage size of an address conversion table also increases. Thus, a cost of the semiconductor storage device increases, and freedom of designing the device is limited by an increase in size of the random access memory.
An object of the present invention is to provide a semiconductor storage device which controls a large capacity of a flash memory by using a small capacity of an address conversion table.
In a semiconductor storage device using a flash memory, a plurality of sectors is managed in the unit of a group consisting of n sectors. A logical sector number is converted to a logical group number and an offset address by dividing the logical sector number with a natural number n and by setting a quotient of division as the logical group number and a remainder of division as the offset address. A conversion table is stored in a random access memory for converting a logical group number to a physical group number. When the flash memory is accessed, a physical group number corresponding to the logical group number is determined with reference to the conversion table and a sector in the flash memory is calculated in correspondence to a sum of the offset address and a product of the physical group number and the natural number n.
Further, a management means is provided for storing information for managing each group of n sectors of the same physical group number. Data for a logical group number and an offset address is written to a sector in the group of the physical group number in correspondence to the logical group. If number any data has already been written to one of the sectors in a group, another group which is not being used is searched, and the data is written to a sector in correspondence to the offset address in the another group. Then, the physical group number in correspondence to the logical group number is updated in the conversion table as a physical group number of the another group, and an address of the sector in the management means is also updated as the physical group number in correspondence to the logical group number before the conversion table is updated. On the other hand, when a sector of a logical sector number is read, a physical group number in correspondence to the logical group number is obtained by referring to the conversion table. If the group of the physical group number is used, the group is accessed. However, if another physical group number is stored in the management means in correspondence to the logical group number before the conversion table is updated, a status of the another physical group number is checked. This processing is continued with reference to the management means until a physical group number of a group which stores the data of a sector of the logical sector number is found. Preferably, if a number of checks for finding a physical group number of a group which stores the data of a sector of the logical sector number exceeds a predetermined number, latest data are written to a group which is not being used, and the physical group number in correspondence to the logical address number is updated as a number of the group which is not being used in the conversion table.
An advantage of the present invention is that a capacity of the address conversion table in a semiconductor storage memory can be decreased.